<?php

/**
 * Description of Admin_Layout
 *
 * @author Anh Nguyen
 */
class Admin_Layout
{

    private $_CI;

    function __construct()
    {
        $this->_CI = & get_instance();
        $this->_CI->load->library('Blockcache');
        $this->_CI->load->library('Minifier');
        $this->_CI->load->model('product_model');

        $this->setCssJs();
    }

    public function test()
    {
        $productType = 1;
        $productOtherType = 2;
        $parentId = 0;
        $result = $this->_CI->product_model->getProduct($productType, $parentId);
    }

    public function header($filename = 'header_view', $title = 'Admin')
    {
        $data = array();
        $data['title'] = $title;
        $data['u_acc'] = $this->_CI->session->userdata('u_acc');
        $data['combinedCss'] = $this->_CI->minifier->GetCombined('css');
        $data['combinedJs'] = $this->_CI->minifier->GetCombined('js');
        echo $this->_CI->load->view($filename, $data, true);
    }

    public function leftMenu($filename = 'left_menu_view')
    {
        $mainType = 1;
        $otherType = 2;
        $nameMainProduct = $this->_CI->product_model->getProduct($mainType, 0);
        $listMainProduct = $this->_CI->product_model->getGroupProduct($mainType);

        $nameOtherProduct = $this->_CI->product_model->getProduct($otherType, 0);
        $listOtherProduct = $this->_CI->product_model->getGroupProduct($otherType);

        $data = array();
        $data['listMainProduct'] = $listMainProduct;
        $data['nameMainProduct'] = $nameMainProduct;
        $data['listOtherProduct'] = $listOtherProduct;
        $data['nameOtherProduct'] = $nameOtherProduct;

        echo $this->_CI->load->view($filename, $data, true);
    }

    public function setCssJs()
    {
        $this->_CI->minifier->AddCss('base');
        $this->_CI->minifier->AddCss('calendar');
        $this->_CI->minifier->AddCss('extensions');
        $this->_CI->minifier->AddCss('forms');
        $this->_CI->minifier->AddCss('grid');
        $this->_CI->minifier->AddCss('style');
        $this->_CI->minifier->AddCss('visualize');
        $this->_CI->minifier->AddCss('lists');
        $this->_CI->minifier->AddCss('uploadify');

        $this->_CI->minifier->AddJs('jquery-1.7.min');
        $this->_CI->minifier->AddJs('jquery-ui-1.8.1.min');
        $this->_CI->minifier->AddJs('jquery.cookie');
        $this->_CI->minifier->AddJs('jquery.lightbox-0.5.min');
        $this->_CI->minifier->AddJs('jquery.tipsy');
        $this->_CI->minifier->AddJs('jquery.treeview.min');
        $this->_CI->minifier->AddJs('jquery.wysiwyg');
        $this->_CI->minifier->AddJs('modernizr-1.5.min');
        $this->_CI->minifier->AddJs('functions');
    }

}

?>
